stageWidth = (the activeWindow).rect.right - (the activeWindow).rect.left
stageHeight = (the activeWindow).rect.bottom - (the activeWindow).rect.top
maxH = stageWidth - memberRect.width
maxV = stageHeight - memberRect.height
theLoc[1] = max(0, min(theLoc[1], maxH))
theLoc[2] = max(0, min(theLoc[2], maxV))
theLoc = theLoc + myMember.regPoint
mySprite.loc = theLoc
else
lastChar = theString.char.count
textHeight = charPosToLoc(myMember, lastChar)[2]
if textHeight > mySprite.height then
myMember.boxType = #scroll
else
myMember.boxType = #fixed
end if
end if
end if
end
on DisplayText_GetReference me
return me
end
on ErrorAlert me, theError, data
case theError of
#getPDLError:
alert("Error: This behavior works only with Field and Text members." & RETURN & RETURN & "Hit OK and then delete this behavior from the sprite." & RETURN & RETURN & "For more information on deleting Behaviors, see the Help system.")
if the optionDown then
return [#getPDLError: [#comment: "ERROR: Wrong member type. Click 'Cancel'." & RETURN & " Use only with Field and Text members.", #format: #string, #range: [EMPTY], #default: EMPTY]]
end if
otherwise:
case theError of
#invalidMemberType:
behaviorName = string(me)
delete word 1 of behaviorName
delete char -30001 of behaviorName
delete char -30001 of behaviorName
alert("BEHAVIOR ERROR: Frame " & the frame & ", Sprite " & me.spriteNum & RETURN & RETURN & "Behavior " & behaviorName & " only works with Field and Text members." & RETURN & RETURN & "Current member type = #" & data)
halt()
#invalidString:
if the runMode = "Author" then
alert("BEHAVIOR ERROR: Frame " & the frame & ", Sprite " & me.spriteNum & RETURN & "Behavior " & behaviorName & RETURN & RETURN & "The DisplayText_SetText handler could not treat the following as a string:" & RETURN & RETURN & data)
end if
#invalidPoint:
if the runMode = "Author" then
alert("BEHAVIOR ERROR: Frame " & the frame & ", Sprite " & me.spriteNum & RETURN & "Behavior " & behaviorName & RETURN & RETURN & "The DisplayText_SetText handler could not treat the following as a point:" & RETURN & RETURN & data)
end if
end case
end case
end
on getPropertyDescriptionList me
if not (the currentSpriteNum) then
exit
end if
theMember = sprite(the currentSpriteNum).member
case theMember.type of
#field, #text:
otherwise:
return ErrorAlert(me, #getPDLError)
end case
return [#myDisplayType: [#comment: "Display Text sprite behaves as a:", #format: #symbol, #range: ["status bar (fixed size and position)", "tooltip (dynamic size and position)"], #default: "in a fixed position (status bar)"]]